package com.wangp.mywrite.coding;

import java.util.Random;

/***
 * @author wangpeng
 * @since 2022-02-18  15:39
 */
public class RepeatNum {

    static Random random = new Random();

    public static void main(String[] args) {
        int[] arr = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3};
        sortRandom(arr);

        int tmp = 0;
        for (int i = 1; i < 10; i++) {
            tmp ^= i;
        }
        for (int i : arr) {
            tmp ^= i;
        }
        System.out.println(tmp);
    }

    private static void sortRandom(int[] arr) {
        for (int i = 0; i < 1000; i++) {
            int index = random.nextInt(arr.length - 1);
            int num = arr[0];
            arr[0] = arr[index];
            arr[index] = num;
        }
    }
}
